#include <iostream>
#include <vector>
#include <string>

using namespace std;

string convert(string s, int numRows) {
    string ret;
    if(numRows == 1) return s;
    for(int i = 0; i < numRows; i++){
        int j = i, w = 1;
        while(j < s.size()){
            ret.push_back(s[j]);
            if((w || i == 0) && i != numRows-1){
                j += 2 * (numRows - 2 - i) + 2;
                w = 0;
            }else{
                j += 2 * i;
                w = 1;
            }
        }
    }
    return ret;
}

int main(){
    string s = "A"; int numRows = 1;
    cout << convert(s, numRows) << endl;
    return 0;
}
